﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using PSGQuickTimeTracker.Properties;


namespace PSGQuickTimeTracker.DataModel
{
    
    class MyTheme : Theme
    {

        public MyTheme()
        {
            ControlBack = GetColor("ControlBack");
            ControlFore = GetColor("ControlFore");
            LabelFore = GetColor("LabelFore");
            MainBack = GetColor("MainBack");
            TabActiveBorder = GetColor("TabActiveBorder");
            TabActiveBack = GetColor("TabActiveBack");
            TabActiveFore = GetColor("TabActiveFore");			
            TabInactiveBorder = GetColor("TabInactiveBorder");
            TabInactiveBack = GetColor("TabInactiveBack");
            TabInactiveFore = GetColor("TabInactiveFore");			
            TitleBar = GetColor("TitleBar");

            MainFont = Settings.Default.Theme_MainFont;
            LinkBtnFont = Settings.Default.Theme_LinkBtnFont;
        }


        
        /// <summary>
        /// Returns the <typeparamref name="System.Drawing.Color"/> value corresponding to
        /// the given property name from the settings config file.
        /// </summary>
        /// <exception>
        /// Throws an exception if the given property name does not match an existing theme
        /// setting name.
        /// </exception>
        private Color GetColor(string propName)
        {
            try
            {
                var color = (Color)Settings.Default["Theme_" + propName];
                return color;
            }
            catch
            {
                throw new Exception("Theme property name doesn't exist.");
            }
        }
        
    }

    

    /// <summary>
    /// Generic Theme class.
    /// </summary>
    class Theme
    {
        public Theme()
        {
        }
        
        #region Color Properties
        public Color ControlBack { get; set; }
        public Color ControlFore { get; set; }
        public Color LabelFore { get; set; }
        public Color MainBack { get; set; }
        public Color TabActiveBorder { get; set; }
        public Color TabActiveBack { get; set; }
        public Color TabActiveFore { get; set; }
        public Color TabInactiveBorder { get; set; }
        public Color TabInactiveBack { get; set; }
        public Color TabInactiveFore { get; set; }
        public Color TitleBar { get; set; } 
        #endregion

        #region Font Properties
        public Font MainFont { get; set; }
        public Font LinkBtnFont { get; set; }       
        #endregion
    }
}
